home *** CD-ROM | disk | FTP | other *** search
- Path: news.ov.com!news
- From: glenn@ov.com (Fletcher.Glenn@ov.com)
- Newsgroups: comp.lang.c
- Subject: Re: Segmentation fault at return statement. C
- Date: 22 Jan 1996 18:05:09 GMT
- Organization: OpenVision
- Message-ID: <4e0jkl$e80@spanky.pls.ov.com>
- References: <4dm2n1$egk@murphy.servtech.com>
- Reply-To: glenn@ov.com
- NNTP-Posting-Host: foghorn.pls.ov.com
-
- In article egk@murphy.servtech.com, Avijit Dasgupta <avi@servtech.com> writes:
- >Hi all,
- >
- >I am not being able to figure out why I get a segmentation fault in
- >a return stmt.
- >
- >main.c:
- >
- >main()
- >{
- >...
- >...
- > calls a function test() returning int
- >
- >}
- >
- >test.c:
- >
- >test()
- >{
- >
- >..
- >...
- >..
- >83: return(999); <----- Segmentation fault at this stmt.
- >}
- >
- >Running dbx I get these error messages:
- >
- >(dbx) where
- >=> [1] test( ) at line 83
- >dbx: bad data address
- >dbx fetch at 0x697075a4 failed - I/O error
- >dbx : attempt to read stack failed - bad frame pointer
- >(dbx)
- >
- >I can't figure out, bcoz this function gets called multiple times and
- >fails only after a fixed X times ... Any Help ?
- >
-
-
- There is insufficient information here to make a diagnosis. I can, however,
- guess that you are stomping data in the stack, perhaps by using more than
- the allocated space for some of your automatic variables. Perhaps you
- are using an array of ints, and stepping off the end of the array?
-
- Fletcher.Glenn@ov.com
-
-
-